<template>
  <div class="my-goods-item">
    <div class="left">
      <div class="custom-control custom-checkbox">
          <!-- 当不修改id时点击发现都是第一个选中 当吧id这种唯一标识符绑定时就解决这种问题 根本原因就是便利好多次改变的都是一个标签 -->
        <input type="checkbox" class="custom-control-input" :id="gobj.id" v-model="gobj.goods_state"
        >
        <label class="custom-control-label" :for="gobj.id">
          <img :src="gobj.goods_img" alt="">
        </label>
      </div>
    </div>
    <div class="right">
      <div class="top">{{gobj.goods_name}}</div>
      <div class="bottom">
        <span class="price">¥{{gobj.goods_price}}</span>
        <span>
            <!-- 将对象原封不动的传给count子组件 这样就相当于也是引用数据类型 传给子组件的相当于是堆内存地址 -->
            <MyCount :gobj="gobj"></MyCount>
        </span>
      </div>
    </div>
  </div>
</template>

<script>
import MyCount from './MyCount'

export default {
    props:{
        gobj:Object
    },
    components:{
        MyCount
       
    }
}
</script>

<style lang="less" scoped>
.my-goods-item {
  display: flex;
  padding: 10px;
  border-bottom: 1px solid #ccc;
  .left {
    img {
      width: 120px;
      height: 120px;
      margin-right: 8px;
      border-radius: 10px;
    }
    .custom-control-label::before,
    .custom-control-label::after {
      top: 50px;
    }
  }
  .right {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    .top{
        font-size: 14px;
        font-weight: 700;
    }
    .bottom {
      display: flex;
      justify-content: space-between;
      padding: 5px 0;
      align-items: center;
      .price {
        color: red;
        font-weight: bold;
      }
    }
  }
}

</style>